<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="a">
        <span class="b">hello</span>
        <span>world</span>
    </div>

    <button>点击删除</button>

    <script>

        const a = document.querySelector('#a');
        const b = document.querySelector('.b');
        const btn = document.querySelector('button');

        btn.addEventListener('click', function () {
            // a.remove();
            // a.removeChild(b);
            // b.remove();
            // const parent = b.parentNode;
            // console.log(parent);
            // 删除自己的爸爸
            this.parentNode.remove();
        });




    </script>
</body>
</html>